package com.example.star.service;

import com.example.star.entity.Song;
import com.example.star.mapper.SongMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SongService {

    @Autowired
    private SongMapper songMapper;

    public void saveSong(Song song) {
        songMapper.insertSong(song);
    }

    public boolean isSongNameExists(String songname) {
        return songMapper.countSongByName(songname) > 0;
    }

    public List<Song> getAllSongs() {
        return songMapper.getAllSongs();
    }
    public List<Song> getSongsBySingerName(String singerName) {
        return songMapper.getSongsBySingerName(singerName);
    }
}